package com.tianji.learning.mapper;

import com.tianji.learning.domain.po.PointsBoard;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 学霸天梯榜 Mapper 接口
 * </p>
 *
 * @author huanmo
 * @since 2025-09-24
 */
public interface PointsBoardMapper extends BaseMapper<PointsBoard> {

    void createPointsBoardTable(@Param("tableName") String tableName);

    @Select("SELECT id, user_id, points FROM ${tableName} LIMIT #{offset}, #{pageSize}")
    List<PointsBoard> selectByTableName(@Param("tableName") String tableName,
                                        @Param("offset") Long offset,
                                        @Param("pageSize") Integer pageSize);

    @Select("SELECT COUNT(*) FROM ${tableName}")
    Long selectCountByTableName(@Param("tableName") String tableName);

    void createPointsRecordTable(@Param("tableName") String tableName);
}
